<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    

<xsl:template match="/">
  <HTML>
	<HEAD>
		<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"/>
		<TITLE>IQ TOOLS REPORT</TITLE>
	</HEAD>
	<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" DIR="LTR">
	<TABLE WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
	<TR>
		<TD VALIGN='TOP'>
			<P><IMG SRC="logo.png" ALIGN="BOTTOM" BORDER="0"/></P>
		</TD>
		<TD>
			<P ALIGN='CENTER'><SPAN><B>IQ TOOLS REPORT</B></SPAN></P>
		</TD>
		<TD>
          <xsl:value-of select="META/Version"/>
			<B>Date     : </B><xsl:value-of select="/IQCheck/META/Date"/> <p/>
			<B>Version  : </B><xsl:value-of select="/IQCheck/META/Version"/> <p/>
			<B>Hostname : </B><xsl:value-of select="/IQCheck/META/Hostname"/>  <p/>
			<B>HOST IP  : </B><xsl:value-of select="/IQCheck/META/IP"/>  <p/>
		</TD>
	</TR>
	</TABLE>
	
	<p/><p/><hr/><p/><p/>
	
	 <h2>OperatingSystem</h2>
	 
	 <TABLE WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
	 <TR bgcolor="#9acd32">
		<TH> Key</TH>
		<TH> Value </TH>
	 </TR>
	 <xsl:for-each select="/IQCheck/OperatingSystem/*">
		 <tr><td><xsl:value-of select="name(.)"/></td><td><xsl:value-of select="."/></td></tr>
      </xsl:for-each>
	 </TABLE>
	
	<p/><p/><hr/><p/><p/>
 
  <h2>Hardware</h2>
	<h3>Hardware (disks)</h3>
    <table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Name</th>
        <th>Disk Size</th>
      </tr>	   
      <xsl:for-each select="/IQCheck/hardware/disks/Disk">
        <tr>
          <td><xsl:value-of select="name"/></td>
          <td ALIGN="CENTER"><xsl:value-of select="size"/></td>
        </tr>
      </xsl:for-each>
    </table>
	<p/><p/>
	
  <h3>Hardware (others)</h3>
    <table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Name</th>
        <th>Value</th>
      </tr>	   
	  <tr><td><B>Memory </B></td><td><xsl:value-of select="/IQCheck/hardware/memory"/> </td></tr>
	  <tr><td><B>CPU    </B></td><td><xsl:value-of select="/IQCheck/hardware/cpu"/> </td></tr>
    </table>
	<p/><p/>
	<hr/>
	<p/><p/>
	
  <h2>ServerId</h2>
	 <TABLE WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
	 <TR bgcolor="#9acd32">
		<TH> Key</TH>
		<TH> Value </TH>
	 </TR>
	 <xsl:for-each select="/IQCheck/serverId/*">
		 <tr><td><xsl:value-of select="name(.)"/></td><td><xsl:value-of select="."/></td></tr>
      </xsl:for-each>
	 </TABLE>
	<p/><p/>
	<hr/>
	<p/><p/>
	
  <h2>Environment Variables</h2>
    <table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Name</th>
        <th>Value</th>
      </tr>	   
      <xsl:for-each select="/IQCheck/Environment/Variable">
        <tr>
          <td><xsl:value-of select="name"/></td>
          <td ALIGN="LEFT"><xsl:value-of select="value"/></td>
        </tr>
      </xsl:for-each>
    </table>
	<p/><p/>
	<hr/>
	<p/><p/>
	
  <h2>Softwares</h2>
    <table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Name</th>
        <th>Version</th>
      </tr>	   
      <xsl:for-each select="/IQCheck/Softwares/Software">
        <tr>
          <td><xsl:value-of select="name"/></td>
          <td ALIGN="CENTER"><xsl:value-of select="version"/></td>
        </tr>
      </xsl:for-each>
    </table>
	<p/><p/>
	<hr/>
	<p/><p/>
	
  <h2>Hotfixes</h2>
    <table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Id</th>
        <th>Type</th>
      </tr>	   
      <xsl:for-each select="/IQCheck/hotfixes/hotfixe">
        <tr>
          <td><xsl:value-of select="name"/></td>
          <td ALIGN="CENTER"><xsl:value-of select="version"/></td>
        </tr>
      </xsl:for-each>
    </table>
	<p/><p/>
	<hr/>
	<p/><p/>

    <h2>Services</h2>
    <table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Name</th>
        <th>Status</th>
      </tr>	   
      <xsl:for-each select="/IQCheck/Services/Service">
        <tr>
          <td><xsl:value-of select="name"/></td>
          <td ALIGN="CENTER"><xsl:value-of select="status"/></td>
        </tr>
      </xsl:for-each>
    </table>
	
	<p/><p/><hr/><p/><p/>
	
	<p/><p/><hr/><p/><p/>
	
	<h2>My files </h2>
	<xsl:apply-templates select="/IQCheck/directories/directory"/>
	
	
  </BODY>
  </HTML>
</xsl:template>


<xsl:template match="directory">
	<hr/>
	<h3> Directory </h3>
	<p/>
	
	<xsl:value-of select="attributes/Name"/>
	<xsl:value-of select="attributes/Pattern"/>
	
	<table WIDTH='100%' BORDER='1' BORDERCOLOR='#000001' CELLPADDING='1' CELLSPACING='0'>
      <tr bgcolor="#9acd32">
        <th>Name</th>
		<th>Checksum</th>
        <th>Product Version</th>
		<th>File Version</th>
		<th>Extracted Information</th>
      </tr>	   
	 <xsl:for-each select="files/file">
        <tr>
          <td><font size="0.5"><xsl:value-of select="name"/></font></td>
          <td ALIGN="CENTER"><xsl:choose>
				<xsl:when test="checksum"><xsl:value-of select="checksum"/></xsl:when>
				<xsl:otherwise>N/A</xsl:otherwise>
			   </xsl:choose></td>
		  <td ALIGN="CENTER"><xsl:choose>
				<xsl:when test="Versions/ProductVersion"><xsl:value-of select="Versions/ProductVersion"/></xsl:when>
				<xsl:otherwise>N/A</xsl:otherwise>
			   </xsl:choose></td>
		  <td ALIGN="CENTER"><xsl:choose>
				<xsl:when test="Versions/FileVersion"><xsl:value-of select="Versions/FileVersion"/></xsl:when>
				<xsl:otherwise>N/A</xsl:otherwise>
			   </xsl:choose></td>
		  <xsl:choose>
				<xsl:when test="extracted"><td><xsl:apply-templates select="extracted"/></td></xsl:when>
				<xsl:otherwise><td ALIGN="CENTER">N/A</td></xsl:otherwise>
		  </xsl:choose>
        </tr>
      </xsl:for-each>
	</table>

</xsl:template>

<xsl:template match="extracted">
	 <xsl:for-each select="*">
		<p><xsl:value-of select="."/></p>
      </xsl:for-each>
</xsl:template>
	
</xsl:stylesheet>